﻿using DH.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DH.MQ
{
    class Program
    {
        public class Message : BaseMessage
        {
            public string MessageValue { get; set; }
            public override BaseMessage GetMessageResult(string bm)
            {
                BaseMessage result = Newtonsoft.Json.JsonConvert.DeserializeObject<Message>(bm);
                return result;
            }
        }
        public static void Main(string[] args)
        {
            RMQProvider provider = new RMQProvider();
            Message bm = new Message();
            Message bm2 = new Message();
            var message = "Hello World! " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            var message2 = "Hello World2222222222222! " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            bm.MessageValue = message;
            bm2.MessageValue = message2;

            string messageID = "";
            provider.SendMessage(bm.BuildMessage(bm,out messageID), "lu9.order.1234",false);

            provider.SendMessage(bm2.BuildMessage(bm2, out messageID), "lu9.product.12345", false);

            provider.SendMessage(bm.BuildMessage(bm, out messageID), "lu9.order.7894", false);
        }
    }
}
